<?xml version="1.0" encoding="UTF-8"?>

<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:rich="http://richfaces.org/rich" xmlns:a4j="http://richfaces.org/a4j">

<h:form>
    <h:panelGrid columns="2">
        <h:outputLabel value="#{filterMsg.brand}" for="cbBrands"/>
        <h:selectOneMenu id="cbBrands"
                         value="#{FilterBean.brands.selectedValue}"
                         style="width: 400px">
            <f:selectItems value="#{FilterBean.brands.items}"/>
            <a4j:support event="onchange"
                         action="#{FilterBean.updateOes}"
                         limitToList="true"
                         ajaxSingle="true"
                         process="cbBrands"
                         reRender="dvOes"/>
        </h:selectOneMenu>
    </h:panelGrid>

    <h:panelGroup id="dvOes">
        <h:panelGroup id="dvOesEmpty" rendered="#{empty FilterBean.selectedOes}">
            <h:outputText value="#{filterMsg.emptyManufactorWarning}"/>
        </h:panelGroup>
        <h:panelGroup id="dvOesNotEmpty" rendered="#{not empty FilterBean.selectedOes}">
            <rich:dataTable id="tblOes"
                            value="#{FilterBean.selectedOes}"
                            var="oe"
                            sortMode="single"
                            title="#{filterMsg.oes}"
                            reRender="dsOes"
                            style="margin-top: 10px">
                <rich:column sortBy="#{oe.name}">
                    <f:facet name="header">
                        <h:outputText value="#{filterMsg.oes}"/>
                    </f:facet>
                    <h:outputText value="#{oe.name}"/>
                </rich:column>
            </rich:dataTable>

        </h:panelGroup>
    </h:panelGroup>
</h:form>
</html>
